
<template>
      <tiny-form :inline="true" label-position="center" label-align="true" label-width="120px">
        <tiny-form-item label="公告标题">
          <tiny-input v-model="data.form.titleName" placeholder="公告标题" :disabled="data.disabled"></tiny-input>
        </tiny-form-item>
        <tiny-form-item label="公告类型">
          <vo-select default select  dictCode="noticeTypeList" v-model:value="data.form.noticeType" />
        </tiny-form-item>
        <tiny-form-item label="状态">
            <tiny-radio-group v-model="data.form.status">
                <tiny-radio-button label="0">正常</tiny-radio-button>
                <tiny-radio-button label="1">停用</tiny-radio-button>
          </tiny-radio-group>
        </tiny-form-item>
        <tiny-form-item label="内容">
            <tiny-fluent-editor v-model="data.form.context" :options="options" :data-type="false" :data-upgrade="false" style="height: 200px;"></tiny-fluent-editor>
        </tiny-form-item>
        <tiny-row style="padding-top: 25px;text-align: center;">
            <tiny-form-item >
            <tiny-button type="primary" @click="saveBtn">保存</tiny-button>
            <tiny-button type="primary" @click="delBatch">重置</tiny-button>
        </tiny-form-item>

        </tiny-row>

      </tiny-form>
</template>
<script setup>
  import {reactive, onBeforeMount, ref, getCurrentInstance, toRef} from 'vue';
  import { TinyRadio, TinyRadioGroup, TinyRadioButton } from '@opentiny/vue'
  import { TinyFluentEditor } from '@opentiny/vue'
  let {proxy} = getCurrentInstance();
  const options = ref({
  placeholder: '请输入内容',
  lang: 'zh-CN' ,
  modules: {
        // 工具栏
        toolbar: [
        ['undo', 'redo', 'clean', 'format-painter'],
        ['bold', 'italic', 'underline', 'strike'],
        [{ list: 'bullet' }, { list: 'ordered' }],
        [{ align: '' }, { align: 'center' }, { align: 'right' }],
        ['better-table'],
        ['fullscreen']
        ],
        
        // 字数统计
        counter: {
            count:2000
        },
       }
    })
   const data = reactive({
    form:{status:'0'}
    

   })
   const saveBtn = ()=>{
    console.log(data.form)
    proxy.$api.system.saveNotice(data.form).then(res=>{
        console.log(res)
    })
   }

   const props = defineProps({
    data:{}
   })
   data.form = toRef(props,"data")

</script>

<style lang="scss" scoped>

.edit{
    height: 250px;
}
</style>